package com.zhsm.fuxi.mvp.presenter

import com.hankkin.library.mvp.presenter.RxLifePresenter
import com.hankkin.reading.control.UserControl
import com.hankkin.reading.http.HttpClientUtils
import com.zhsm.fuxi.mvp.contract.OrderCenterContract
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * Created by GuZhC on 2018/10/9.
 * describe:
 */
class OrderCenterPresenter : RxLifePresenter<OrderCenterContract.IView>(), OrderCenterContract.IPresenter {
    override fun getOrderList(pager:Int) {
        HttpClientUtils.Builder.getPaipiaHttp().getOrdeList(UserControl.getId(),pager)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeEx({
                    getMvpView().getOrderListSucess(it)
                }, {
                    getMvpView().getOrderListFail()
                }).bindRxLifeEx(RxLife.ON_DESTROY)
    }

}